<?php 
    namespace Home\Model;
    use Think\Model;
    class FoodModel extends Model{
        //自动验证
        protected $_validate = array(
          array('food','require','食材不能为空'), 
          array('food','','食材已经存在咯！',0,'unique',1), 
        );
    }